﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MyPS.Models;
using MyPSDALayer;

namespace MyPS.Areas.Manage.Controllers
{
    [Authorize]
    public class ManageMessageController : Controller
    {
        MyPSEntities db = new MyPSEntities();
        //
        // GET: /Manage/ManageMessage/

        public ActionResult Index()
        {    
            return View(db.Messages.OrderByDescending(o=>o.CreateDate).ToList());
        }

        public ActionResult Details(int id = 0)
        {
            var mode = db.Messages.Find(id);
            if (mode == null)
            {
                return HttpNotFound();
            }
            return View(mode);
        }

        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }
    }
}
